package AttachmentService

import (
	"context"
	"seawolf-admin-go/internal/model/entity"
	"seawolf-admin-go/utility/db"
)

func GetModelByMd5(ctx context.Context, fileMd5 string) (*entity.Attachment, error) {
	var aModel *entity.Attachment
	err := db.GetUnSafaTable(ctx, "attachment").Where("md5", fileMd5).Scan(&aModel)
	if err != nil {
		return nil, err
	}

	return aModel, nil
}
